package com.example.myproject;

import static org.junit.Assert.*;

import java.util.List;

import org.junit.Test;

public class AudioUploadDAOTest {

	@Test
	public void audioUploadDAOfindByID() {
		AudioUploadDAO testAudioDAO = new AudioUploadDAO();
		AudioUploadDTO testAudio1 = new AudioUploadDTO();
		testAudio1.setId(new Long(1111));
		testAudio1.setTitle("Test Title");
		testAudioDAO.save(testAudio1);
		AudioUploadDTO testAudio2 = testAudioDAO.findById(new Long(1111));
		assertTrue("testAudio2's title should be \"Test Title\".", testAudio2
				.getTitle().equals("Test Title"));
	}

	@Test
	public void audioUpLoadDAOemptyList() {
		AudioUploadDAO testAudioDAO = new AudioUploadDAO();
		List<AudioUploadDTO> listAudioDTO = testAudioDAO.list();
		assertTrue("List should be empty.", listAudioDTO.isEmpty());
	}

	@Test
	public void audioUploadDAOlist() {
		AudioUploadDAO testAudioDAO = new AudioUploadDAO();
		AudioUploadDTO testAudio1 = new AudioUploadDTO();
		testAudioDAO.save(testAudio1);
		AudioUploadDTO testAudio2 = new AudioUploadDTO();
		testAudioDAO.save(testAudio2);
		List<AudioUploadDTO> listAudioDTO = testAudioDAO.list();
		assertEquals("List size should be 2.", 2, listAudioDTO.size());
	}
}
